<?php

// NOTE: Make sure this file is not accessible when deployed to production
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
    die('不允许访问这个文件.');
}

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');

defined('BASE_PATH') or define('BASE_PATH', dirname(dirname(__DIR__)));
defined('APP_BASE_PATH') or define('APP_BASE_PATH', BASE_PATH . '/apps/manage');

require BASE_PATH . '/vendor/autoload.php';
require BASE_PATH . '/vendor/yiisoft/yii2/Yii.php';
require BASE_PATH . '/common/config/bootstrap.php';
require APP_BASE_PATH . '/config/bootstrap.php';

$config = yii\helpers\ArrayHelper::merge(
    require BASE_PATH . '/common/config/main.php',
    require BASE_PATH . '/common/config/main-local.php',
    require APP_BASE_PATH . '/config/main.php',
    require APP_BASE_PATH . '/config/main-local.php'
);


$config = yii\helpers\ArrayHelper::merge(
    require BASE_PATH . '/common/config/main.php',
    require BASE_PATH . '/common/config/main-local.php',
    require BASE_PATH . '/common/config/test.php',
    require BASE_PATH . '/common/config/test-local.php',
    require APP_BASE_PATH . '/config/main.php',
    require APP_BASE_PATH . '/config/main-local.php',
    require APP_BASE_PATH . '/config/test.php',
    require APP_BASE_PATH . '/config/test-local.php'
);

(new heihei\web\Application($config))->run();
